package com.itheima.mapper;

import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmpMapper {

    @Select("select  * from emp where  username=#{username}")
     Emp findByUserName(String username);


    /*    @Select("select  count(*) from emp")
        Long findByCount();
    @Select("select  *from  emp limit  #{startIndex},#{pageSize}")
        List<Emp> findList(Integer startIndex, Integer pageSize);*/
    List<Emp> findList3(String name, Integer gender, LocalDate begin, LocalDate end);

    @Insert("insert into emp values (null,#{username},#{password},#{name},#{gender},#{image},#{job},#{entrydate},#{deptId},#{createTime},#{updateTime})")
    void save(Emp emp);

    @Select("select *from emp where id=#{id}")
    Emp selectById(Integer id);

    void update(Emp emp);

    void delete(List<Integer> ids);


      @Select("select count(*) from emp where dept_id=#{deptId}")
    Integer selectByDeptId(Integer id);
}
